/**
 * Created by Roman on 2016/5/12.
 */
public class FizzHandler implements IWordHandler{

    private IWordHandler nextHandler;

    @Override
    public void setNext(IWordHandler wordHandler) {
        this.nextHandler = wordHandler;
    }

    @Override
    public String handle(int num) {
        if (num % 3 == 0 || Integer.toString(num).contains("3")) {
            return "Fizz";
        }
        return this.nextHandler.handle(num);
    }
}
